import request from "../utils/http.ts";
import {BusinessQueryDTO, BusinessVO} from "../type/business";


/**
 * 获取推荐商家
 * @param queryForm
 * */
export function getRecommendBusinessAPI(queryForm:BusinessQueryDTO) {
    return request<BusinessVO[]>({
        url: '/business/list',
        method: 'post',
        data: queryForm
    })
}

/**
 * 根据类型获取商家
 * @param type
 * */
export function getTypeBusinessAPI(type:number) {
    return request<BusinessVO[]>({
        url: `b-o/business/listByType/${type}`,
        method: 'GET',
    })
}

/**
* 根据id获取商家
* @param id
* */
export function getBusinessAPI(id:number) {
    return request<BusinessVO>({
        url: `/business/getById/${id}`,
        method: 'GET',
    })
}

/**
 * 添加商家
 * @param form
 * */
export function add(form:FormData) {
    return request<BusinessVO>({
        url: '/business/add',
        method: 'post',
        data: form
    })
}
